package com.ogilvy.audi.action;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.ogilvy.audi.bean.Bulletin;
import com.ogilvy.audi.bean.Circle;
import com.ogilvy.audi.bean.Topic;
import com.ogilvy.audi.service.BulletinService;
import com.ogilvy.audi.service.CircleService;
import com.ogilvy.audi.service.TopicService;
import com.ogilvy.frame.action.BaseAction;
@SuppressWarnings("serial")
@Scope("prototype")
@Controller("auti.action.BulletinAction")
public class BulletinAction  extends BaseAction{
	@Autowired
	protected BulletinService bulletinService;
	@Autowired
	protected CircleService circleService;
	@Autowired
	protected TopicService topicService;
	
	public Integer circleId;
	public Integer pageNo;
	public Integer pageSize;
	public Integer bulletinId;
	public List<Bulletin> bulletinList;
	public List<Circle> circleList;
	public List<Topic> topicList;
	
	public Integer count;
	public Bulletin bulletin;
	public String msg;
	public String list(){
		System.out.println("______________________ bulletinAction!!");
		System.out.println("______________________ circleId!!"+circleId);
		Map<String,Object> condition = new HashMap<String,Object>();
		condition.put("circleId", circleId);
		bulletinList = bulletinService.query(condition);
		circleList = circleService.queryCirclesByStatus(1);
		topicList = topicService.queryNewTopic();
		return "list";
	}
	public String add(){
		Bulletin bulletin_ = bulletinService.add(bulletin);
		if(null!=bulletin){
			msg = "操作成功";
		}
		return "show";
		
	}
	public String del(){
		boolean s = bulletinService.del(bulletinId);
		msg = s?"操作成功":"操作失败";
		return "result";
	}

}
